WPS Office.apk(点击下载) / abfo.java


package defpackage;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/* renamed from: abfo  reason: default package */
public class abfo extends aagn {
    public static final String TAG = null;
    private abge CMH;
    private abff CMI;
    public abfp CMJ;
    public abft CMK;
    public abfx CML;
    private abgf CMM;
    private abfr CMN;
    private abgg CMO;
    private abfg CMP;
    protected Map<Long, List<abfz>> CMQ;
    private String CMR;
    public int CMS;
    public int CMT;
    public int CMU;
    private int CMV;
    private int CMW;
    public int CMX;

    public abfo(aazp aazp) throws IOException {
        super(aazp);
        this.CMQ = new HashMap();
        this.CMS = 0;
        this.CMT = 0;
        this.CMU = 0;
        this.CMV = 0;
        this.CMW = 0;
        this.CMX = 0;
        a(abfq.heV());
    }

    public abfo(File file) throws IOException, aazi {
        super(aazp.am(new FileInputStream(file)));
        this.CMQ = new HashMap();
        this.CMS = 0;
        this.CMT = 0;
        this.CMU = 0;
        this.CMV = 0;
        this.CMW = 0;
        this.CMX = 0;
        a(abfq.heV());
    }

    public abfo(File file, boolean z) throws IOException, aazi {
        this(file, z, mzd.FF_DOCX);
        this.CMR = file.getAbsolutePath();
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public abfo(File file, boolean z, mzd mzd) throws IOException, aazi {
        super(z ? b(file, mzd) : aazp.a(file.getAbsolutePath(), aazs.READ));
        this.CMQ = new HashMap();
        this.CMS = 0;
        this.CMT = 0;
        this.CMU = 0;
        this.CMV = 0;
        this.CMW = 0;
        this.CMX = 0;
        if (!z) {
            a(abfq.heV());
        }
    }

    public abfo(InputStream inputStream) throws IOException {
        super(abeu.am(inputStream));
        this.CMQ = new HashMap();
        this.CMS = 0;
        this.CMT = 0;
        this.CMU = 0;
        this.CMV = 0;
        this.CMW = 0;
        this.CMX = 0;
        a(abfq.heV());
    }

    public static abfo a(File file, mzd mzd) throws aazi, IOException {
        return new abfo(file, true, mzd);
    }

    private static aazp b(File file, mzd mzd) {
        try {
            aazp bF = aazp.bF(file);
            aazv aib = aazz.aib(abgb.CNp.gVK());
            bF.a(aib, abab.INTERNAL, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", null);
            String contentType = abgb.CNp.getContentType();
            if (mzd.equals(mzd.FF_DOTX)) {
                contentType = abgb.CNq.getContentType();
            }
            bF.a(aib, contentType);
            return bF;
        } catch (Exception e) {
            throw new aagp(e);
        }
    }

    public final void a(abfz abfz) {
        List<abfz> list = this.CMQ.get(abfz.heT());
        if (list == null) {
            list = new ArrayList<>(1);
            this.CMQ.put(abfz.heT(), list);
        }
        if (!list.contains(abfz)) {
            list.add(abfz);
        }
    }

    public final int azQ(int i) throws aazi {
        ArrayList arrayList = new ArrayList();
        for (List<abfz> list : this.CMQ.values()) {
            arrayList.addAll(list);
        }
        int size = Collections.unmodifiableList(arrayList).size() + 1;
        aazv aib = aazz.aib(abfz.CNl[i].axC(size));
        while (this.BVS.a(aib) != null) {
            size++;
            aib = aazz.aib(abfz.CNl[i].axC(size));
        }
        return size;
    }

    @Override // defpackage.aago
    public final void b(aaou aaou) {
        ew.assertNotNull("importer should not be null.", aaou);
        super.b(aaou);
        if (this.CMM != null) {
            this.CMM.b(aaou);
        }
        if (this.CMO != null) {
            this.CMO.b(aaou);
        }
        if (this.CMN != null) {
            this.CMN.b(aaou);
        }
        if (this.CML != null) {
            this.CML.b(aaou);
        }
        if (this.CMH != null) {
            this.CMH.b(aaou);
        }
        if (this.CMI != null) {
            this.CMI.b(aaou);
        }
        if (this.CMJ != null) {
            this.CMJ.b(aaou);
        }
        if (this.CMK != null) {
            this.CMK.b(aaou);
        }
        if (this.CMP != null) {
            this.CMP.b(aaou);
        }
    }

    /* access modifiers changed from: protected */
    @Override // defpackage.aago
    public final void gVI() throws IOException {
        List<aago> gVH = gVH();
        int size = gVH.size();
        for (int i = 0; i < size; i++) {
            aago aago = gVH.get(i);
            String str = aago.BVV.eWp;
            if (str.equals(abgb.CNx.gVJ()) || str.equals(abgc.COl.gVJ())) {
                this.CMM = (abgf) aago;
            } else if (str.equals(abgb.CNy.gVJ()) || str.equals(abgc.COE.gVJ())) {
                this.CMO = (abgg) aago;
                this.CMO.gVI();
            } else if (str.equals(abgb.CNt.gVJ()) || str.equals(abgc.COo.gVJ())) {
                this.CML = (abfx) aago;
            } else if (str.equals(abgb.CNE.gVJ()) || str.equals(abgc.COp.gVJ())) {
                this.CMI = (abff) aago;
            } else if (str.equals(abgb.CNG.gVJ()) || str.equals(abgc.COq.gVJ())) {
                this.CMJ = (abfp) aago;
            } else if (str.equals(abgb.CNF.gVJ()) || str.equals(abgc.COr.gVJ())) {
                this.CMK = (abft) aago;
            } else if (str.equals(abgb.CNv.gVJ()) || str.equals(abgc.COn.gVJ())) {
                this.CMH = (abge) aago;
            } else if (str.equals(abgb.CNw.gVJ())) {
                this.CMP = (abfg) aago;
            } else if (!str.equals(abgb.CNT.gVJ()) && !str.equals(abgc.COu.gVJ()) && (str.equals(abgb.CNu.gVJ()) || str.equals(abgc.COm.gVJ()))) {
                this.CMN = (abfr) aago;
            }
        }
    }

    public final aazw hda() {
        try {
            return this.BVS.hda();
        } catch (aazi e) {
            hm.e(TAG, "InvalidFormatException", e);
            return null;
        }
    }

    public final aazo hdb() {
        try {
            return this.BVS.hdb();
        } catch (aazi e) {
            hm.e(TAG, "InvalidFormatException", e);
            return null;
        }
    }

    public final aazm hdc() {
        try {
            return this.BVS.hdc();
        } catch (aazi e) {
            hm.e(TAG, "InvalidFormatException", e);
            return null;
        }
    }

    public final int heU() {
        int i = this.CMW + 1;
        this.CMW = i;
        return i;
    }

    public final void parse() throws IOException {
        if (this.CMN != null) {
            this.CMN.parse();
        }
        if (this.CMH != null) {
            this.CMH.parse();
        }
        if (this.CMO != null) {
            this.CMO.parse();
        }
        if (this.CMM != null) {
            this.CMM.parse();
        }
        if (this.CMN != null) {
            this.CMN.parse();
        }
        if (this.CMI != null) {
            abff abff = this.CMI;
            if (!abff.CME) {
                abff.CME = true;
                if (abff.pNP != null) {
                    try {
                        aazh.a(abff.BVU, abff.CMD);
                    } catch (IOException e) {
                        hm.e(abff.TAG, "IOException: ", e);
                        if (eia.e(e)) {
                            throw new aagp(e);
                        }
                    }
                }
            }
        }
        apb.gs(140);
        aoy.gs(140);
        apc.gs(20);
        if (this.pNP != null) {
            aapv aapv = new aapv(this.pNP, this);
            try {
                aazh.a(this.BVU, aapv);
            } catch (fdp e2) {
                throw new fdp();
            } catch (Throwable th) {
                if (this.BVU != null && !this.pNP.po()) {
                    aazh.a(this.BVU, aapv, "utf-16");
                    hm.e(TAG, "Throwable", th);
                    if (eia.e(th)) {
                        throw new RuntimeException(th);
                    }
                } else {
                    return;
                }
            }
        }
        if (this.CML != null && !this.CML.CNj) {
            this.CML.parse();
        }
        if (this.CMP != null) {
            abfg abfg = this.CMP;
            if (!abfg.CME) {
                abfg.CME = true;
                if (abfg.pNP != null) {
                    try {
                        aazh.a(abfg.BVU, abfg.CMF);
                    } catch (IOException e3) {
                        hm.e(abfg.TAG, "IOException: ", e3);
                        if (eia.e(e3)) {
                            throw new aagp(e3);
                        }
                    }
                }
            }
        }
    }
}